PERL=/usr/bin/perl -mlib=third-party

TEST_OPTIONS=-En0 -i0 -d 0x40 \
		--optimize \
		-O Yasco::Parser=hash_get_set:0 \
		-O Yasco::Filter::MapString=debug:0,cipher:1234567890,strings-hash:STRINGS \
		-O Yasco::Filter::MapId=ignore:foo,random-names:0 \
		-O Yasco::Filter::Compress4=verbose:1,debug:0

.PHONY: file test clean

all: yasco

clean:
	rm src/parser.output lib/Yasco/Parser.pm \
		test/test-*.js test/sound-*.js

test: yasco
	$(PERL) ./yasco.pl -f test/test.js -o test/test-min.js $(TEST_OPTIONS)
	$(PERL) ./yasco.pl -f test/test.js -o test/test-compressed.js -cccc $(TEST_OPTIONS)
	$(PERL) ./yasco.pl -f test/sound.js -o test/sound-min.js $(TEST_OPTIONS)
	$(PERL) ./yasco.pl -f test/sound.js -o test/sound-compressed.js -cccc $(TEST_OPTIONS)

yasco: lib/Yasco/Parser.pm

lib/Yasco/Parser.pm: src/parser.py
	$(PERL) ./third-party/Parse/yapp.pl -vsm Yasco::Parser -o $@ $<
